import QtQml 2.0
import QtQuick 2.9
import QtQuick.Controls 2.2
//import TaoQuick 1.0

Item {
    id: base
    property int currentIndex: -1
    property var images
    property int maxCount: images.length
    property var dirs
    property int dir: -1

    Component.onCompleted: {
        currentIndex = 0
        dir = 3
    }
    Timer {
        id: autoPlayTimer
        interval: 4000
        running: true//autoPlaySwitch.checked
        repeat: true
        property bool reserve: false
        //triggeredOnStart: true
        onTriggered: {
            if (reserve) {
                base.currentIndex--
            } else {
                base.currentIndex++
            }
            if (base.currentIndex >= images.length - 1) {
                reserve = true
            } else if (base.currentIndex <= 0) {
                reserve = false
            }
        }
    }
}
